package com.junlong0716.module.common.utils

import android.view.animation.Animation
import android.view.animation.TranslateAnimation



/**
 *@author: EdsionLi
 *@description:
 *@date: Created in 2018/4/17 上午9:58
 *@modified by:
 */
object AnimationUtil{
    private val TAG = AnimationUtil::class.java.simpleName

    /**
     * 从控件所在位置移动到控件的底部
     *
     * @return
     */
    fun moveToViewBottom(): TranslateAnimation {
        val mHiddenAction = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
                0.0f, Animation.RELATIVE_TO_SELF, 1.0f)
        mHiddenAction.duration = 500
        return mHiddenAction
    }

    fun moveToViewLeft(): TranslateAnimation {
        val mHiddenAction = TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f,
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
                0.0f, Animation.RELATIVE_TO_SELF, 0.0f)
        mHiddenAction.duration = 500
        return mHiddenAction
    }


    fun moveToViewRight(): TranslateAnimation {
        val mHiddenAction = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF,
                0.0f, Animation.RELATIVE_TO_SELF, 0.0f)
        mHiddenAction.duration = 500

        return mHiddenAction
    }

    fun moveFromViewBottom(): TranslateAnimation {
        val mHiddenAction = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
                1.0f, Animation.RELATIVE_TO_SELF, 0.0f)
        mHiddenAction.duration = 500
        return mHiddenAction
    }

    /**
     * 从控件的底部移动到控件所在位置
     *
     * @return
     */
    fun moveToViewLocation(): TranslateAnimation {
        val mHiddenAction = TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
                1.0f, Animation.RELATIVE_TO_SELF, 0.0f)
        mHiddenAction.duration = 500
        return mHiddenAction
    }
}